/**
 * Created by win 10 on 2/27/2018.
 */
function GetQueryString(name){
    var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
    var r = window.location.search.substr(1).match(reg);
    if(r!=null)return  unescape(r[2]); return null;
}
$(function () {
    var id = GetQueryString("id");
    $.ajax({
        url: '/sichuansfc/fund/manager/detail.bs?id='+id,
        type: 'get',
        headers: {'FUND_USER_TOKEN': $.cookie('FUND_USER_TOKEN')},
        success: function (data) {
            if (data.status === 100000) {
                data = data.data
                for (var key in data) {
                    if (key == 'staffDtoList') {
                        for (var i = 0; i < data[key].length; i++) {
                            $("#admin-info").append(
                                '<tr class="admin-item" data-value="'+data[key][i].id+'">'+
                                '<td class="add-name">'+data[key][i].name+'</td>'+
                                '<td class="add-job">'+data[key][i].duties+'</td>'+
                                '<td class="add-phone">'+data[key][i].tel+'</td>'+
                                '<td class="add-email">'+data[key][i].email+'</td>'+
                                '</tr>'
                            )
                        }
                    } else {
                        if (key == 'governmentFund' || key == 'stateCapital' || key == 'stateHolding') {
                            data[key] = data[key]===true ? 1 : 0;
                            $("[name="+key+"]").val(data[key]);
                        }
                        if (key == 'fundTime' || key == 'chinaRegisterTime') {
                            data[key] = data[key] ? parseCastingDate(data[key].toString(), 'yyyy-MM-dd'): "";
                            $("[name="+key+"]").val(data[key]);
                        }
                        $("[name="+key+"]").val(data[key]);
                    }
                }
                $(".count").text(data.updateCount);
            }
        },
        error: function () {
            alert("服务器错误");
        }
    })

})